

	****************************************************************************
	**
	**
	**		NAME:		Imke Harbers
	**		DATE: 		July 29th, 2019
	**		PROJECT: 	Identity for all?  World Development Manuscript -WD13003
	**					Code to generate tables in section 6 of the paper 
	**
	**				
	**		
	**
	****************************************************************************
	
	
	
***Preliminaries

*Please set directory as appropriate 

global dir "INSERTPATH"


*** Multilevel Models (Table 1) 

use "$dir\Table 1.dta", clear

** Descriptive Statistics (Appendix)
tabstat gender delaymonths indicmarg percentpopi CCTenrol ruggmun, columns(stat) statistics(mean sd min max N) format(%9.2g)

** Model 1: Empty model
xtmixed delaymonths || clavemuni:, mle var
xtmrho

** Model 2: DV IV
xtmixed delaymonths CCTenrol || clavemuni:, mle var
xtmrho

** Model 3: Full model with controls
xtmixed delaymonths CCTenrol i.gender indicmarg percentpopi ruggmun	|| clavemuni:, mle var
xtmrho


			
*** Panel Models (Table 2) 
			
*** Models 1 & 2 in Paper 

use "$dir\Table 2 Birthyear.dta", clear

tsset clavemunregis year

***Generate Descriptive Statistics for Sample 
xtsum mun_regis_delay_female mun_regis_delay_male percenthhprog indic pop1000 percentpopi ruggmun if percenthhprog ~=. 

* Fixed effects (model only with time-varying variables) 

 xtreg mun_regis_delay_female percenthhprog i.year , fe
 xtreg mun_regis_delay_male percenthhprog i.year if stateid ~=20 , fe

 
 * Random effects models in appendix
 
xtreg mun_regis_delay_female percenthhprog indic pop1000 percentpopi ruggmun i.year, re
xtreg mun_regis_delay_male percenthhprog indic pop1000 percentpopi ruggmun i.year, re



*** Models 3 & 4 in Paper 

use "$dir\Table 2 Regyear.dta", clear

tsset clavemunregis year

***Generate Descriptive Statistics for Sample 

xtsum mun_regis_delayreg_male mun_regis_delayreg_female percenthhprog indic pop1000 percentpopi ruggmun if percenthhprog ~=. 

* Fixed effects (model only with time-varying variables) 

xtreg mun_regis_delayreg_female percenthhprog i.year, fe
xtreg mun_regis_delayreg_male percenthhprog i.year, fe

* Random effects models in appendix
 
xtreg mun_regis_delayreg_female percenthhprog indic pop1000 percentpopi ruggmun i.year, re
xtreg mun_regis_delayreg_male percenthhprog indic pop1000 percentpopi ruggmun i.year, re
 

 *** Models 5 & 6 in Paper 

*** Overall registrations as dependent variable

xtsum mun_regis_count_male mun_regis_count_female percenthhprog indic pop1000 percentpopi ruggmun if percenthhprog ~=. 
 
* Fixed effects (model only with time-varying variables) 

xtreg mun_regis_count_female percenthhprog i.year , fe 
xtreg mun_regis_count_male percenthhprog i.year , fe 
 
 * Random effects 
xtreg mun_regis_count_female percenthhprog indic pop1000 percentpopi ruggmun i.year , re
xtreg mun_regis_count_male percenthhprog indic pop1000 percentpopi ruggmun i.year , re  
 